/*
 * @(#)CalendarUtility.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */

package com.dcivision.calendar;

import java.sql.Timestamp;
import java.util.Comparator;

import com.dcivision.calendar.bean.CalendarRecord;

/**
  CalendarUtility.java
  This class is the data access bean for table "CONTACT_COMPANY".
  @author          Jenny Li
  @company         DCIVision Limited
  @creation date   6/12/2003
  @version         $Revision: 1.4 $
 */


public class TimeComparator implements Comparator{

  public static final String REVISION = "$Revision: 1.4 $";


  public int compare(Object o1, Object o2) {

    Timestamp timestamp1 = null;
    Timestamp timestamp2 = null;

    if (o1 instanceof CalendarRecord)
		timestamp1 = ((CalendarRecord)o1).getDatetime();

//    else
//        timestamp1 = ((WorkflowProgress)o1).getDatetime();

    if (o2 instanceof CalendarRecord)
		timestamp2 = ((CalendarRecord)o2).getDatetime();
//    else
//        timestamp2 = ((WorkflowProgress)o2).getDatetime();

    return timestamp1.compareTo(timestamp2);

  }

  public boolean equals(Object obj) {
 	return obj.equals (this);
  }

}
